package 结构器模式.组合模式;

/**
 * @Description 菜单项，属于叶子结点
 * @Author shallow
 * @Date 2023/3/6 13:43
 */

public class MenuItem extends MenuComponent{
    public MenuItem(String name,int level) {
        this.name = name;
        this.level = level;
    }

    @Override
    public void printName() {
        for (int i = 0; i < level; i++) {
            System.out.print("--");
        }
        System.out.println("菜单项名称:"+name);
    }
}
